@extends('admin.common.base-master')

@section('html-head')

@endsection

@section('html-body')
    <div id="content">
        <!-- cur-position start -->
        <div id="cur-position">
            <span class="tit">当前位置：</span>
            @if($type == 0)
                 <a href="">关于我们</a>
            @elseif($type == 1)
                <a href="">服务协议</a>
            @endif
        </div>

        <!--二级目录-->
        @include('admin.common.home-header')
        <div class="filter-box clearfix">

            <div class="fr">
                @if($type == 0)
                    @if(!$sysSetUpList)
                    <a class="addBtn" href="{{route("Admin.Home.aboutUsSet")}}">新增</a>
                    @endif
                @elseif($type == 1)
                    @if(!$sysSetUpList)
                    <a class="addBtn" href="{{route("Admin.Home.serviceAgreementSet")}}">新增</a>
                    @endif
                @endif
            </div>
        </div>
        <div class="table-box">
            <table class="table">
                <thead>
                <tr>
                    <th>ID</th>
                    <th>标题</th>
                    <th>操作</th>
                </tr>
                </thead>
                <tbody>
                @if($sysSetUpList)
                    <tr id="banner_{{$sysSetUpList->id}}">
                        <td>{{$sysSetUpList->id}}</td>
                        <td>{{$sysSetUpList->title}}</td>
                        @if($type == 0)
                            <td><a class="color2" href="{{route("Admin.Home.aboutUsSet")}}?id={{$sysSetUpList->id}}">编辑</a>
                        @elseif($type == 1)
                            <td><a class="color2" href="{{route("Admin.Home.serviceAgreementSet")}}?id={{$sysSetUpList->id}}">编辑</a>
                        @endif
                        <span>|</span> <a href="javascript:void(0);" class="del" data-id="{{$sysSetUpList->id}}">删除 </a></td>
                    </tr>
                @endif
                </tbody>
            </table>
        </div>
    </div>



    <script>
        $(document).on("click",".del",function(){
            var id = $(this).attr("data-id");

            noty({
                text: '你确定要删除吗?',
                buttons: [
                    {addClass: 'btn btn-primary', text: '确定', onClick: function($noty) {
                            $noty.close();
                            $.ajax({
                                url:'{{route('Api.Admin.sys.delSysSetUp')}}',
                                type:'post',
                                dataType:'json',
                                data:{id:id},
                                success:function(obj){
                                    if(obj.level == "success"){
                                        window.location.reload();
                                    }else{
                                        noty({type:obj.level,text:obj.message,timeout:600});
                                    }
                                },
                                error:function(obj){
                                    console.log(obj);
                                }

                            });
                        }
                    },
                    {addClass: 'btn btn-danger', text: '取消', onClick: function($noty) {
                            $noty.close();
                        }
                    }
                ]
            });

        });


    </script>
@endsection